package datamining.algorithms;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import settings.Settings;

import datamining.miner.chain.Extender;
import datamining.miner.chain.SearchLatticeNode;
import datamining.miner.general.Fragment;
import datamining.sequence.Sequence;
import datamining.sequence.SequenceFactory;


public interface Algorithm<ItemType> {

	/**
	 * Initialize the algorithm
	 * 
	 * @param graphs
	 *            the set of graphs that will be search for frequent fragments
	 * @param factory
	 *            the factory new graphs will be created with
	 * @param settings
	 *            the settings for the search
	 * @return a collection with all fragments that will not be found by the
	 *         algorithm
	 */
	public Collection<Fragment> initialize(
			final List<Sequence<ItemType>> sequences,
			final SequenceFactory<ItemType> factory,
			final Settings settings);
	
	/**
	 * @return an iterator over the initial nodes for the search
	 */
	public Iterator<SearchLatticeNode> initialNodes();
	
	/**
	 * @param threadIdx
	 * @return a (new) Extender Object for the given thread (index)
	 */
	public Extender getExtender(final int threadIdx);
}
